home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
pascal
/
facilis.zip
/
ZELLER.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1985-10-04
|
768b
|
39 lines
program zeller(input, output);
{$t+ }
var day, month, year,
zday, m, y1, y2 : integer;
begin
writeln('This program computes the day of the Week from the Date');
writeln;
write('Enter month:');
read(month);
writeln;
write('Enter day:');
read(day);
writeln;
write('Enter year:');
read(year);
if month < 3
then begin
m:=month + 10;
year:=year - 1
end else
m:=month - 2;
y1:=year div 100;
y2:=year mod 100;
zday:=(day + trunc(2.6*m - 0.1)
+ y2 + y2 div 4
+ y1 div 4 - 2*y1 + 49) mod 7;
writeln;
write('Day of the week (0=Sun, 6=Sat):',zday)
end.
4
+ y1 div 4 - 2*y1 + 49) mod 7;
writeln;